/**
 * 2
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 24-9-21 上午10:56
 */

#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

int main() {
    string s;
    getline(cin, s);
    stringstream ss(s);
    string tmp;
    vector<int> a;
    while (getline(ss, tmp, ',')) {
        a.push_back(stoi(tmp));
    }
    vector<bool> f(a.size(), false);
    f[0] = true;
    for (int i = 0; i < a[i]; ++i) {
        if (f[i]) {
            for (int j = 1; j <= a[i] && i + j < f.size(); ++j) {
                f[i + j] = true;
            }
        }
    }
    cout << (f[f.size() - 1] ? "true" : "false");
    return 0;
}